package zzti.com.Presenter;

import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.BaseAdapter;
import android.widget.TextView;

import java.util.List;

import zzti.com.Modle.FunctionModle;
import zzti.com.hongbao.R;

/**
 * Created by ASUS-PC on 2016/4/14.
 */
public  class FunctionAdapter extends BaseAdapter {
    private Context context;
    FunctionModle functionData;
    List<String> FunctionList;
    ViewHolder holder;

    public FunctionAdapter(Context context,List<String> FunctionList){
        this.context=context;
        this.FunctionList=FunctionList;

    }
    @Override
    public int getCount() {
        return FunctionList.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        if(convertView==null) {
            convertView = LayoutInflater.from(context).inflate(R.layout.functionitem, null);
            holder=new ViewHolder();
            holder.textView=(TextView)convertView.findViewById(R.id.textview);
            convertView.setLayoutParams(new AbsListView.LayoutParams((int) (parent.getWidth() / 2) - 1, (int) (parent.getHeight() / 2)));
            convertView.setTag(holder);

        }else {
            holder=(ViewHolder)convertView.getTag();
            convertView.setLayoutParams(new AbsListView.LayoutParams((int) (parent.getWidth() / 2) - 1, (int) (parent.getHeight() / 2)));
        }
        holder.textView.setText(FunctionList.get(position));

        return convertView;
    }

    public class ViewHolder{
        TextView textView;

    }


}